class MyQueue {
    stack<int> q;
    stack<int> bak;
public:
    /** Initialize your data structure here. */
    MyQueue() {
        
    }
    
    /** Push element x to the back of queue. */
    void push(int x) {
        while(!q.empty())
        {
            bak.push(q.top());
            q.pop();
        }
        q.push(x);
        while(!bak.empty())
        {
            q.push(bak.top());
            bak.pop();
        }
    }
    
    /** Removes the element from in front of queue and returns that element. */
    int pop() {
        int val=q.top();
        q.pop();
        return val;
    }
    
    /** Get the front element. */
    int peek() {
        return q.top();
    }
    
    /** Returns whether the queue is empty. */
    bool empty() {
        return q.empty();
    }
